package com.example.li.controller;

import com.example.li.model.Case;
import com.example.li.service.CaseService;
import com.example.li.util.ResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/case")
public class CaseController {
    @Autowired
    CaseService caseService;

    //查询案例列表
    @RequestMapping(value = "/getCaseList", method = RequestMethod.POST)
    public ResultDTO getCaseList(@RequestBody Case case1) {
        return new ResultDTO().success(caseService.getCaseList(case1));
    }

    //增加案例
    @RequestMapping(value = "/insertCase", method = RequestMethod.POST)
    public ResultDTO insertCase(@RequestBody Case case1) {
        return caseService.insertCase(case1);
    }

    //    删除案例
    @RequestMapping(value = "/deleteCase", method = RequestMethod.POST)
    public ResultDTO deleteCase(@RequestBody Case case1) {
        return caseService.deleteCase(case1);
    }
}
